package com.mingqijia.gassafety.statistics.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Getter
@RequiredArgsConstructor
public enum ScreenStatisticsAreaEnum {

    AREA_1(1, "华东区域"),
    AREA_2(2, "华西区域"),
    AREA_3(3, "华中区域"),
    AREA_4(4, "华北区域"),
    AREA_5(5, "东北区域"),
    AREA_6(6, "华南区域");

    private final int code;
    private final String name;

    public static String getStateName(int code) {
        if (code == 0) {
            return null;
        }
        for (ScreenStatisticsAreaEnum areaEnum : ScreenStatisticsAreaEnum.values()) {
            if (areaEnum.code == code) {
                return areaEnum.name;
            }
        }
        return null;
    }

    public static Map<Integer, String> getMap() {
        Map<Integer, String> areaEnumMap = new HashMap<>();
        for (ScreenStatisticsAreaEnum areaEnum : ScreenStatisticsAreaEnum.values()) {
            areaEnumMap.put(areaEnum.code, areaEnum.name);
        }
        return areaEnumMap;
    }
}